import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Son from './page/Son';
import Show from './page/Show';
import Bg from './page/Link';
import { BrowserRouter, Link, Route } from 'react-router-dom';

// 动画
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';


class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      name: 'lzy',
      isShow: false,
    };
  }
  // 生命周期函数
  componentDidMount() {
    //  修改数据
    this.setState({
      name: 'xuancao'
    })
  }
  btn = (event) => {
    console.log(event)
  }
  handle = () => {
    console.log('123')
  }
  show = () => {
    this.setState({ isShow: !this.state.isShow })
  }
  render() {
    return (



      <div className="App">
        <div className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h2 onClick={this.handle}>Welcome to {this.state.name}</h2>
        </div>
        <Son you={this.state.name} click={this.btn} />
        <Show />
        <button onClick={this.show}>
          {this.state.name}
        </button>
        <ReactCSSTransitionGroup transitionName="fade"
          transitionEnterTimeout={500}
          transitionLeaveTimeout={500}>
          {this.state.isShow && <p className='App-p'></p>}
        </ReactCSSTransitionGroup>
       
      </div>


    );
  }
}

export default App;
